#ifndef NOTIFYWND
#define NOTIFYWND
#include "commoninc.h"
#include "projitem.h"
#include "projwnd.h"
#include "csettingswnd.h"

class TopBar : public QFrame {
    Q_OBJECT
public:
    TopBar(QWidget *p = nullptr);
    ~TopBar();

private:
    void initUI();

Q_SIGNALS:
    void hideWnd();
    void showSettingsWnd();

private:
    QPushButton *_hideBtn;
    QPushButton *_settingsBtn;
};

class FootAreaWnd : public QFrame {
    Q_OBJECT
public:
    FootAreaWnd(QWidget *p = nullptr);
    ~FootAreaWnd();

private:
    void initUI();
    void initMainWnd();

private:
    void showMainWnd();
    void hideMainWnd();

private:
    QWidget *_mainWnd;
};

class NotifyWnd : public QWidget, public QAbstractNativeEventFilter {
    Q_OBJECT
public:
    NotifyWnd(QWidget *p = nullptr);
    ~NotifyWnd();

public:
    void showWnd();
    void hideWnd();

private:
    void initUI();
    void initSystemTray();
    void initMainWnd();
    void initSettingsWnd();

    void loadLocalData();
    void saveLocalData();

protected:
    bool eventFilter (QObject *, QEvent *);
    void closeEvent (QCloseEvent *e) { hideWnd(); }
    bool nativeEventFilter (const QByteArray &eventType, void *message, long *result);

private:
    QSystemTrayIcon *sysTrayIco;
    QMenu *tray_menu; // 托盘菜单
    QAction *showAction;
    QAction *quitAction;
    ProjWnd *_projWnd;
    TopBar *_topBar;
    QScrollArea *_mainProjWnd;
    FootAreaWnd *_footAreaWnd;

    bool _isShow;

    ATOM _atom;

    QStackedLayout *_stackedLayout;
    QWidget *_mainWnd;
    QComboBox *_searchEdit;
    CSettingsWnd *_settingsWnd;
};

#endif // NOTIFYWND

